<?php

namespace CommonApi\Controller;

use Think\Controller;
//use Common\RestController;
use Common\CommonController;
use Common\Model\UserHospitalModel;

class HospitalController extends CommonController {


    /**
     * 获取医院对应科室的环信账号id列表
     */
    public function getHuanxinId() {
        $userHospitalModel = new UserHospitalModel;
        //$res = $userHospitalModel->getHospitalHuanxinId(I('hospital_id'),I('keshi_id'));
        $res = $userHospitalModel->getHospitalHuanxinIdByKeshiRelationId(I('hospital_keshi_relation_id'));
        $this->ajaxReturn(['status' => 1, 'data' => ['list' => $res]]);
    }

    public function getHuanxinIdList(){
        $idList = I('hospital_keshi_relation_id_list');
        if(!is_array($idList)){
            $this->ajaxReturn(['status'=>0,'error_info'=>'id list 需为数组']);
        }

        $userHospitalModel = new UserHospitalModel;
        $res = $userHospitalModel->getHospitalHuanxinIdByKeshiRelationIdList($idList);
        $this->ajaxReturn(['status'=>1,'data'=>['list'=>$res]]);
    }

}